# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer:
pkgname=py3-gtts
pkgver=2.5.2
pkgrel=0
pkgdesc="A Python library and CLI tool to interface with Google Translate text-to-speech API"
url="https://github.com/pndurette/gTTS"
arch="noarch"
license="MIT"
depends="
	py3-click
	py3-requests
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-testfixtures
	"
subpackages="$pkgname-pyc"
source="https://github.com/pndurette/gTTS/archive/v$pkgver/gTTS-$pkgver.tar.gz"
# Net required for tests
options="net"
builddir="$srcdir/gTTS-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	rm -r "$pkgdir"/usr/lib/python3*/site-packages/gtts/tests/
	rm -r "$pkgdir"/usr/lib/python3*/site-packages/gtts/tokenizer/tests/
}

sha512sums="
4cd64390f52181c3f1f41abe0c08af4fa0516acee0de4dd3534762978aad3c32c07430a6685a56e7baa2c19fbac08ab2d6ef1f95bc65b3ff130612170cb3ae47  gTTS-2.5.2.tar.gz
"
